package epimarket.beans;
import epimarket.*;

public class CartItem {
  private String name;
  private String description;
  private String picture;
  private double price;
  private String productID;
  private int quantity;
  private double subtotal;

 public CartItem(Product product, int quantity) {
    productID = product.getId();
    name = product.getName();
	picture = product.getPicture();
    description = product.getDescription();
    price = product.getPrice();
    this.quantity = quantity;
    subtotal = Math.round(price*quantity*100.)/100.;
    }

  public String getDescription() { return description; }
  public void setDescription(String description) { this.description = description; }
  
  public String getPicture() { return picture; }
  public void setPicture(String picture) { this.picture = picture; }

  public String getName() { return name; }
  public void setName(String name) { this.name = name; }

  public double getPrice() { return price; }
  public void setPrice(double price) {
    this.price = price;
    subtotal = Math.round(price*quantity*100.)/100.;
    }

  public String getProductID() { return productID; }
  public void setProductId(String productID) { this.productID = productID; }

  public int getQuantity() { return quantity; }
  public void setQuantity(int quantity) {
    this.quantity = quantity;
    subtotal = Math.round(price*quantity*100.)/100.;
    }

  public double getSubtotal() { return subtotal; }
  }
